﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="~/Areas/Back/css/x-admin.css" media="all">
    <script type="text/javascript" src="~/Areas/Back/lib/layui/layui.js"></script>
    <script type="text/javascript" src="~/Areas/Back/js/x-layui.js"></script>
</head>
<body>
    <form class="layui-form" id="formAdd">
        <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item">
            <label class="layui-form-label">ID</label>
            <div class="layui-input-inline">
                <input type="text" name="Id" value="@Model.Id" placeholder="请输入ID" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">留言人姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="Name" value="@Model.Name" placeholder="请输入留言人姓名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">留言内容</label>
            <div class="layui-input-inline">
                <input type="text" name="Cont" value="@Model.Cont" placeholder="请输入留言内容" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">留言时间</label>
            <div class="layui-input-inline">
                <input type="text" name="Time" value="@Model.Time" id="textTime" placeholder="请输入留言时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否回复</label>
            <div class="layui-input-inline">
                <select name="State" lay-filter="aihao">
                    @if (Model.State.Trim() == "已回复")
                    {
                        <option value="已回复" selected>已回复</option>
                        <option value="未回复">未回复</option>
                    }
                    else
                    {
                        <option value="已回复">已回复</option>
                        <option value="未回复" selected>未回复</option>
                    }
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">回复时间</label>
            <div class="layui-input-inline">
                <input type="text" name="ReTime" value="@Model.ReTime" id="textReTime" placeholder="请输入回复时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">回复内容</label>
            <div class="layui-input-inline">
                <input type="text" name="Remark" value="@Model.Remark" placeholder="请输入回复内容" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
    </form>
    <script>
        layui.use(['form', 'layer', 'laydate'], function () {
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var $ = layui.$;

            //各种基于事件的操作，下面会有进一步介绍

            //执行一个laydate实例
            laydate.render({
                elem: '#textTime' //指定元素
            });
            laydate.render({
                elem: '#textReTime'//指定元素
            });
            form.on('submit(*)', function (data) {
                var str = $("#formAdd").serialize();
                $.post("/Back/Message/UpdateMessage", str, function (re) {
                    if (re > 0) {
                        layer.msg("修改成功");
                        parent.layui.$("#butSearch").click();
                        //当你在iframe页面关闭自身时
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    } else {
                        layer.msg("修改失败");
                    }
                }, "text");
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        });
    </script>
</body>
</html>

